import axios from './api';
import Qs from 'qs'

/* 将所有接口统一起来便于维护
 * 如果项目很大可以将 url 独立成文件，接口分成不同的模块
 */

// 单独导出
export const login = (query) => {
    return axios({
        url: '/client/uplogin.json',
        method: 'post',
        data:Qs.stringify(query)
    })
}


export const orderdetail = query => {
    return axios({
        url: '/ordermg/orderdetail.json',
        method: 'post',
        data:Qs.stringify(query)
    })
}
export const orderlist = query => {
    return axios({
        url: '/ordermg/orderlist.json',
        method: 'get',
        data:Qs.stringify(query)
    })
}

export const isaccountbind = query => {
    return axios({
        url: '/wechart/wxusermg/isaccountbind.json',
        method: 'post',
        data:Qs.stringify(query)
    })
}
export const wxautologin = query => {
    return axios({
        url: '/wechart/wxusermg/wxautologin.json',
        method: 'post',
        data:Qs.stringify(query)
    })
}
export const uploadfile = query => {
    return axios({
        url: '/filesystem/uploadfile.json',
        method: 'post',
        data:Qs.stringify(query)
    })
}
export const vendordeal = query => {
    return axios({
        url: '/commonreq/vendordeal.json?',
        method: 'post',
        data:Qs.stringify(query)
    })
}
export const computeprice = query => {
    return axios({
        url: '/commonreq/computeprice.json',
        method: 'post',
        data:Qs.stringify(query)
    })
}
export const mycoupon = query => {
    return axios({
        url: '/ordermg/mycoupon.json',
        method: 'post',
        data:Qs.stringify(query)
    })
}
export const createorder = query => {
    return axios({
        url: '/ordermg/createorder.json',
        method: 'post',
        data:Qs.stringify(query)
    })
}
export const addmailaddress = query => {
    return axios({
        url: '/mailaddressmg/addmailaddress.json',
        method: 'post',
        data:Qs.stringify(query)
    })
}
export const mailaddresslist = query => {
    return axios({
        url: '/mailaddressmg/mailaddresslist.json',
        method: 'get',
        data:Qs.stringify(query)
    })
}
export const mailaddressdetail = query => {
    return axios({
        url: '/mailaddressmg/mailaddressdetail.json',
        method: 'post',
        data:Qs.stringify(query)
    })
}
export const delmailaddress = query => { //删除地址
    return axios({
        url: '/mailaddressmg/delmailaddress.json',
        method: 'post',
        data:Qs.stringify(query)
    })
}
export const selandusemailaddress = query => { //选择并使用地址
    return axios({
        url: '/mailaddressmg/selandusemailaddress.json',
        method: 'post',
        data:Qs.stringify(query)
    })
}
export const ordertk = query => { //订单退款
    return axios({
        url: '/ordermg/ordertk.json',
        method: 'post',
        data:Qs.stringify(query)
    })
}
export const applyfilelist = query => { //
    return axios({
        url: '/ordermg/applyfilelist.json?' + Qs.stringify(query),
        method: 'get',
    })
}
export const payOrder = query => { //
    return axios({
        url: '/ordermg/payOrder.json?' + Qs.stringify(query),
        method: 'get',
    })
}
export const applyordertk = query => { //
    return axios({
        url: '/ordermg/applyordertk.json',
        data: Qs.stringify(query),
        method: 'post',
    })
}
export const applydelay = query => { //
    return axios({
        url: '/ordermg/applydelay.json',
        data: Qs.stringify(query),
        method: 'post',
    })
}
export const getfileguid = query => { //
    return axios({
        url: '/filesystem/getfileguid.json',
        data: Qs.stringify(query),
        method: 'post',
    })
}
export const gettemplatefileurl = query => { //
    return axios({
        url: '/ordermg/gettemplatefileurl.json',
        data: Qs.stringify(query),
        method: 'post',
    })
}
export const mycoupon_mobile = query => { //
    return axios({
        url: '/ordermg/mycoupon_mobile.json',
        data: Qs.stringify(query),
        method: 'post',
    })
}
export const isorderindate = query => { //
    return axios({
        url: '/ordermg/isorderindate.json',
        data: Qs.stringify(query),
        method: 'post',
    })
}
export const delorder = query => { //
    return axios({
        url: '/ordermg/delorder.json',
        data: Qs.stringify(query),
        method: 'post',
    })
}

export const getjyzx = query => { //
    return axios({
        url: '/commonreq/getjyzx.json',
        data: Qs.stringify(query),
        method: 'post',
    })
}

export const getVendorInfo = query => { //
    return axios({
        url: '/commonreq/vendordeal.json',
        data: Qs.stringify(query),
        method: 'post',
    })
}

export const getOrderdetail = query => { //
    return axios({
        url: '/ordermg/orderdetail.json',
        data: Qs.stringify(query),
        method: 'post',
    })
}

export const getbhgs = query => { //
    return axios({
        url: '/commonreq/getbhgs.json',
        data: Qs.stringify(query),
        method: 'post',
    })
}

export const getbhtemplate = query => { //
    return axios({
        url: '/commonreq/getbhtemplate.json?' + Qs.stringify(query),
        method: 'get',
    })
}

export const w_uploadfile = query => {
    return axios({
        url: '/ordermg/uploadfile.json',
        method: 'post',
        headers: {'Content-Type': 'multipart/form-data'},
        data:query
    })
}

export const getFpinfo = query => {
    return axios({
        url: '/receiptmg/gethisfpinfo.json',
        method: 'post',
        data:Qs.stringify(query)
    })
}

export const getPayway = query => {
    return axios({
        url: '/ordermg/getpayway.json',
        method: 'post',
        data:Qs.stringify(query)
    })
}

export const getReceipttype = query => {
    return axios({
        url: '/receiptmg/receipttype.json?' + Qs.stringify(query),
        method: 'get',
    })
}

export const savereceiptbeforepay = query => {
    return axios({
        url: '/receiptmg/savereceiptbeforepay.json',
        method: 'post',
        data:Qs.stringify(query)
    })
}

export const offlinepay = query => {
    return axios({
        url: '/ordermg/offlinepay.json',
        method: 'post',
        data:Qs.stringify(query)
    })
}

export const offlinepayUpload = query => {
    return axios({
        url: '/filesystem/uploadfile.json',
        method: 'post',
        headers: {'Content-Type': 'multipart/form-data'},
        data:query
    })
}

export const applypg = query => {
    return axios({
        url: '/ordermg/applypg',
        method: 'post',
        data:Qs.stringify(query)
    })
}

// 兑换优惠卷
export const myCouponConvert = query => {
    return axios({
        url: '/myCoupon/convert',
        method: 'post',
        data:Qs.stringify(query)
    })
}

// 默认全部导出
export default {
    login,
    orderdetail,
    isaccountbind,
    wxautologin,
    orderlist,
    uploadfile,
    w_uploadfile,
    vendordeal,
    computeprice,
    mycoupon_mobile,
    createorder,
    addmailaddress,
    mailaddresslist,
    mailaddressdetail,
    delmailaddress,
    selandusemailaddress,
    ordertk,
    applyfilelist,
    payOrder,
    applyordertk,
    applydelay,
    getfileguid,
    gettemplatefileurl,
    isorderindate,
    delorder,
    getjyzx,
    getVendorInfo,
    getOrderdetail,
    getbhgs,
    getbhtemplate,
    getFpinfo,
    getPayway,
    getReceipttype,
    savereceiptbeforepay,
    offlinepay,
    offlinepayUpload,
    mycoupon,
    applypg,
    myCouponConvert,
}
